import Vue from 'vue'
import App from './App.vue'
import Search from './Search.vue'
import Home from './Home.vue'
import './plugins/element.js'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import VueRouter from 'vue-router';



Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(VueRouter);

//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

let router = new VueRouter({
    mode: 'history',
    routes: [
        //一个个对象
        { path: '/', name:"/", component: Home },
        { path: '/search', name:"search", component: Search},
        { path: '/wx/share', name:"wx_share", component: (resolve) => require(['@/WX_Share'], resolve)}
]
});

new Vue({
    el: '#app',
    router: router,
    render: c => c(App),
})
